package logic

import (
	"context"
	"work/model/mysql"

	"work/workrpc/internal/svc"
	"work/workrpc/workrpc"

	"github.com/zeromicro/go-zero/core/logx"
)

type StoryAndUserListLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewStoryAndUserListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *StoryAndUserListLogic {
	return &StoryAndUserListLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *StoryAndUserListLogic) StoryAndUserList(in *workrpc.StoryAndUserListRequest) (*workrpc.StoryAndUserListResponse, error) {
	// todo: add your logic here and delete this line
	var list []*workrpc.StoryAndUserList
	list, err := mysql.StoryUserList(mysql.DB, in)
	if err != nil {
		return nil, err
	}
	return &workrpc.StoryAndUserListResponse{
		List: list,
	}, nil
}
